package hospital.action;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;

import hospital.model.DocScheduleModel;
import hospital.model.EmpInfoModel;
import hospital.model.PatientInfoModel;
import hospital.model.RecordDetailModel;
import hospital.model.VisitRecordModel;
import hospital.service.DoctorService;
import hospital.util.HospitalUtil;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;

public class DoctorOperation extends ActionSupport implements Preparable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8157519586051858980L;

	private HospitalUtil hospitalUtil;
	private String recordPatientId;
	private String recordStart;
	private String recordEnd;
	private String recordDiagnosis;
	private String recordDrug;
	private String recordInstruction;
	private String recordDeaNum;
	private String recordTreatSche;
	private String recordComment;
	private VisitRecordModel visitRecord;
	private DoctorService doctorService;
	private String startDate;
	private String startTime;
	private String endDate;
	private String endTime;
	private String yearStart;
	private String monthStart;
	private String dayStart;
	private String hourStart;
	private String minuteStart;
	private String yearEnd;
	private String monthEnd;
	private String dayEnd;
	private String hourEnd;
	private String minuteEnd;

	private String searchUserId;
	private String searchFirstname;
	private String searchLastname;
	private List<PatientInfoModel> patientSearchResult;

	private String recordListPatientId;
	private List<RecordDetailModel> recordDetailList;

	private String searchDocId;
	private String searchDocFirstname;
	private String searchDocLastname;
	private List<EmpInfoModel> docSearchResult;

	private String searchStaffId;
	private String searchStaffFirstname;
	private String searchStaffLastname;
	private List<EmpInfoModel> staffSearchResult;

	private String confirmedPatientId;
	private String confirmedDocId;
	private String confirmedStaffId;

	private List<DocScheduleModel> doctorAppointments;

	private boolean flag;
	private String message;

	private String lookupPmsId;
	private Set<EmpInfoModel> grantedDoc;
	private Set<EmpInfoModel> grantedStf;
	private String removePmsId;
	private String removePmsDocId;
	private String removePmsStfId;

	private String origPassword;
	private String newPassword;
	private String confirmedNewPassword;

	@Override
	public void prepare() throws Exception {
		clearActionErrors();
		clearFieldErrors();
	}

	public String newRecord() {
		return SUCCESS;
	}

	public String createRecord() {
		flag = true;
		message = "";
		if (recordPatientId.trim().equals("") || recordDeaNum.trim().equals("") || recordDiagnosis.trim().equals("")
				|| recordDrug.trim().equals("") || recordInstruction.trim().equals("") || startDate.trim().equals("")
				|| startTime.trim().equals("") || endDate.trim().equals("") || endTime.trim().equals("")
				|| recordTreatSche.trim().equals("")) {
			flag = false;
			message += "All fields are required except comment.<br />";
		}
		String wrappedPatientId = recordPatientId.trim();
		long patientId = -1;
		if (!wrappedPatientId.equals("")) {
			patientId = hospitalUtil.deIdWrapper(wrappedPatientId, (byte) 0);
		}
		if (patientId == -2) {
			flag = false;
			message += "Patient id is not valid.<br />";
		} else {
			boolean result = doctorService.checkPatientExist(patientId);
			if (result == false) {
				flag = false;
				message += "The patient does not exist.<br />";
			}
		}
		Calendar cStart = Calendar.getInstance();
		Calendar cEnd = Calendar.getInstance();
		if (!startDate.trim().equals("") && !startTime.trim().equals("") && !endDate.trim().equals("")
				&& !endTime.trim().equals("")) {
			SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm");
			Date parsedStart = null;
			Date parsedEnd = null;
			try {
				parsedStart = sdf.parse(startDate + " " + startTime);
				parsedEnd = sdf.parse(endDate + " " + endTime);
			} catch (ParseException e) {
				e.printStackTrace();
			}
			if (parsedStart != null) {
				cStart.setTime(parsedStart);
			}
			if (parsedEnd != null) {
				cEnd.setTime(parsedEnd);
			}
			if (cStart.getTimeInMillis() >= cEnd.getTimeInMillis()) {
				flag = false;
				message += "The start time should come before the end time.<br />";
			}
			if (cEnd.getTimeInMillis() > Calendar.getInstance().getTimeInMillis()) {
				flag = false;
				message += "The end time should not come after the current time.<br />";
			}
		}
		if (false == flag) {
			return SUCCESS;
		}
		visitRecord.setPatientId(patientId);
		RequestAttributes ra = RequestContextHolder.getRequestAttributes();
		long currentUserId = (long) ra.getAttribute("currentUserId", RequestAttributes.SCOPE_SESSION);
		visitRecord.setDoctorId(currentUserId);
		visitRecord.setDiagnosis(recordDiagnosis.trim());
		visitRecord.setDeaNum(recordDeaNum.trim());
		visitRecord.setDrug(recordDrug.trim());
		visitRecord.setInstruction(recordInstruction.trim());

		visitRecord.setStartTime(cStart.getTimeInMillis());
		visitRecord.setEndTime(cEnd.getTimeInMillis());
		visitRecord.setDoctorComment(recordComment.trim());
		visitRecord.setTreatmentSchedule(recordTreatSche.trim());
		boolean result = doctorService.createRecord(visitRecord);
		if (result) {
			flag = true;
			message = "Create the record successfully.";
			return SUCCESS;
		} else {
			flag = false;
			message = "Fail to create the record.";
			return SUCCESS;
		}
	}

	public String viewRecord() {
		return SUCCESS;
	}

	public String searchResult() {
		String wrappedUserId = searchUserId.trim();
		long userId = -1;
		if (!wrappedUserId.equals("")) {
			userId = hospitalUtil.deIdWrapper(wrappedUserId, (byte) 0);
		}
		String firstname = searchFirstname.trim();
		String lastname = searchLastname.trim();
		if (userId == -1 && firstname.equals("") && lastname.equals("")) {
			patientSearchResult.clear();
			return SUCCESS;
		}
		patientSearchResult = doctorService.getPatientResult(userId, firstname, lastname);
		Iterator<PatientInfoModel> it = patientSearchResult.iterator();
		PatientInfoModel tmp = new PatientInfoModel();
		while (it.hasNext()) {
			tmp = it.next();
			userId = tmp.getUserId();
			tmp.setUserId(hospitalUtil.idWrapper(userId, (byte) 0));
		}
		return SUCCESS;
	}

	public String searchResultDefault() {
		String wrappedUserId = searchUserId.trim();
		long userId = -1;
		if (!wrappedUserId.equals("")) {
			userId = hospitalUtil.deIdWrapper(wrappedUserId, (byte) 0);
		}
		String firstname = searchFirstname.trim();
		String lastname = searchLastname.trim();
		if (userId == -1 && firstname.equals("") && lastname.equals("")) {
			patientSearchResult.clear();
			return SUCCESS;
		}
		patientSearchResult = doctorService.getPatientResultDefault(userId, firstname, lastname);
		Iterator<PatientInfoModel> it = patientSearchResult.iterator();
		PatientInfoModel tmp = new PatientInfoModel();
		while (it.hasNext()) {
			tmp = it.next();
			userId = tmp.getUserId();
			tmp.setUserId(hospitalUtil.idWrapper(userId, (byte) 0));
		}
		return SUCCESS;
	}

	public String recordList() {
		String wrappedUserId = recordListPatientId.trim();
		long userId = -1;
		if (!wrappedUserId.equals("")) {
			userId = hospitalUtil.deIdWrapper(wrappedUserId, (byte) 0);
		}
		recordDetailList = doctorService.getRecordDetailList(userId);
		Iterator<RecordDetailModel> it = recordDetailList.iterator();
		RecordDetailModel tmp = new RecordDetailModel();
		long patientId, doctorId;
		while (it.hasNext()) {
			tmp = it.next();
			patientId = tmp.getPatientId();
			tmp.setPatientId(hospitalUtil.idWrapper(patientId, (byte) 0));
			doctorId = tmp.getDoctorId();
			tmp.setDoctorId(hospitalUtil.idWrapper(doctorId, (byte) 1));
		}
		return SUCCESS;
	}

	public String goBackToDoctorHome() {
		return SUCCESS;
	}

	public String docSearchResult() {
		String wrappedUserId = searchDocId.trim();
		long userId = -1;
		if (!wrappedUserId.equals("")) {
			userId = hospitalUtil.deIdWrapper(wrappedUserId, (byte) 1);
		}
		String firstname = searchDocFirstname.trim();
		String lastname = searchDocLastname.trim();
		if (userId == -1 && firstname.equals("") && lastname.equals("")) {
			docSearchResult.clear();
			return SUCCESS;
		}
		docSearchResult = doctorService.getDocResult(userId, firstname, lastname);
		Iterator<EmpInfoModel> it = docSearchResult.iterator();
		EmpInfoModel tmp = new EmpInfoModel();
		while (it.hasNext()) {
			tmp = it.next();
			userId = tmp.getUserId();
			tmp.setUserId(hospitalUtil.idWrapper(userId, (byte) 1));
		}
		return SUCCESS;
	}

	public String staffSearchResult() {
		String wrappedUserId = searchStaffId.trim();
		long userId = -1;
		if (!wrappedUserId.equals("")) {
			userId = hospitalUtil.deIdWrapper(wrappedUserId, (byte) 2);
		}
		String firstname = searchStaffFirstname.trim();
		String lastname = searchStaffLastname.trim();
		if (userId == -1 && firstname.equals("") && lastname.equals("")) {
			staffSearchResult.clear();
			return SUCCESS;
		}
		staffSearchResult = doctorService.getStaffResult(userId, firstname, lastname);
		Iterator<EmpInfoModel> it = staffSearchResult.iterator();
		EmpInfoModel tmp = new EmpInfoModel();
		while (it.hasNext()) {
			tmp = it.next();
			userId = tmp.getUserId();
			tmp.setUserId(hospitalUtil.idWrapper(userId, (byte) 2));
		}
		return SUCCESS;
	}

	public String permission() {
		return SUCCESS;
	}

	public String grantPermission() {
		flag = true;
		message = "";
		if (confirmedPatientId.trim().equals("")) {
			flag = false;
			message += "Patient id is required.<br />";
		}
		if (confirmedDocId.trim().equals("") && confirmedStaffId.trim().equals("")) {
			flag = false;
			message += "Doctor id and staff id cannot be both empty.<br />";
		}
		String wrappedPatientId = confirmedPatientId.trim();
		long patientId = -1;
		if (!wrappedPatientId.equals("")) {
			patientId = hospitalUtil.deIdWrapper(wrappedPatientId, (byte) 0);
			if (patientId == -2) {
				flag = false;
				message += "Patient id is not valid.<br />";
			} else {
				boolean result = doctorService.checkPatientExist(patientId);
				if (result == false) {
					flag = false;
					message += "The patient does not exist.<br />";
				}
			}
		}

		String wrappedDoctorId = confirmedDocId.trim();
		long doctorId = -1;
		if (!wrappedDoctorId.equals("")) {
			doctorId = hospitalUtil.deIdWrapper(wrappedDoctorId, (byte) 1);
			if (doctorId == -2) {
				flag = false;
				message += "Doctor id is not valid.<br />";
			} else {
				boolean result = doctorService.checkDoctorExist(doctorId);
				if (result == false) {
					flag = false;
					message += "The doctor does not exist.<br />";
				}
			}
		}

		String wrappedStaffId = confirmedStaffId.trim();
		long staffId = -1;
		if (!wrappedStaffId.equals("")) {
			staffId = hospitalUtil.deIdWrapper(wrappedStaffId, (byte) 2);
			if (staffId == -2) {
				flag = false;
				message += "Staff id is not valid.<br />";
			} else {
				boolean result = doctorService.checkStaffExist(staffId);
				if (result == false) {
					flag = false;
					message += "The staff does not exist.<br />";
				}
			}
		}

		if (false == flag) {
			return SUCCESS;
		}
		boolean result = doctorService.grantPermission(patientId, doctorId, staffId);
		if (result) {
			flag = true;
			message = "Grant the permission successfully.";
			return SUCCESS;
		} else {
			flag = false;
			message = "Fail to grant the permission.";
			return SUCCESS;
		}
	}

	public String pmsDocStf() {
		flag = true;
		message = "";
		String wrappedPatientId = lookupPmsId.trim();
		long patientId = -1;
		if (!wrappedPatientId.equals("")) {
			patientId = hospitalUtil.deIdWrapper(wrappedPatientId, (byte) 0);
		}
		if (patientId == -2) {
			flag = false;
			message += "Patient id is not valid.<br />";
		} else {
			boolean result = doctorService.checkPatientExist(patientId);
			if (result == false) {
				flag = false;
				message += "The patient does not exist.<br />";
			}
		}
		if (false == flag) {
			return SUCCESS;
		}
		RequestAttributes ra = RequestContextHolder.getRequestAttributes();
		long currentUserId = (long) ra.getAttribute("currentUserId", RequestAttributes.SCOPE_SESSION);
		// EmpInfoModel currentDoctor =
		// doctorService.getCurrentDoctor(currentUserId);
		grantedDoc = doctorService.getGrantedDoc(patientId);
		if (grantedDoc == null) {
			grantedDoc.clear();
		} else if (!grantedDoc.isEmpty()) {
			for (EmpInfoModel doc : grantedDoc) {
				if (doc != null && doc.getUserId() == currentUserId) {
					grantedDoc.remove(doc);
				}
				if (doc != null) {
					doc.setUserId(hospitalUtil.idWrapper(doc.getUserId(), (byte) 1));
				}
			}
		}
		grantedStf = doctorService.getGrantedStf(patientId);
		if (null == grantedStf) {
			grantedStf.clear();
		}
		for (EmpInfoModel stf : grantedStf) {
			if (stf != null) {
				stf.setUserId(hospitalUtil.idWrapper(stf.getUserId(), (byte) 2));
			}
		}
		flag = true;
		return SUCCESS;
	}

	public String removeDocPermission() {
		flag = true;
		message = "";
		String wrappedPatientId = removePmsId.trim();
		long patientId = -1;
		if (!wrappedPatientId.equals("")) {
			patientId = hospitalUtil.deIdWrapper(wrappedPatientId, (byte) 0);
		}
		String wrappedDoctorId = removePmsDocId.trim();
		long doctorId = -1;
		if (!wrappedDoctorId.equals("")) {
			doctorId = hospitalUtil.deIdWrapper(wrappedDoctorId, (byte) 1);
		}
		grantedDoc = doctorService.removeDocPermission(patientId, doctorId);
		RequestAttributes ra = RequestContextHolder.getRequestAttributes();
		long currentUserId = (long) ra.getAttribute("currentUserId", RequestAttributes.SCOPE_SESSION);
		// EmpInfoModel currentDoctor =
		// doctorService.getCurrentDoctor(currentUserId);
		if (grantedDoc == null) {
			flag = false;
			message = "Fail to remove.";
			return SUCCESS;
		} else if (!grantedDoc.isEmpty()) {
			for (EmpInfoModel doc : grantedDoc) {
				if (doc != null && doc.getUserId() == currentUserId) {
					grantedDoc.remove(doc);
				}
				if (doc != null) {
					doc.setUserId(hospitalUtil.idWrapper(doc.getUserId(), (byte) 1));
				}
			}
		}
		flag = true;
		message = "Remove successfully.";
		return SUCCESS;
	}

	public String removeStfPermission() {
		flag = true;
		message = "";
		String wrappedPatientId = removePmsId.trim();
		long patientId = -1;
		if (!wrappedPatientId.equals("")) {
			patientId = hospitalUtil.deIdWrapper(wrappedPatientId, (byte) 0);
		}
		String wrappedStaffId = removePmsStfId.trim();
		long staffId = -1;
		if (!wrappedStaffId.equals("")) {
			staffId = hospitalUtil.deIdWrapper(wrappedStaffId, (byte) 2);
		}
		grantedStf = doctorService.removeStfPermission(patientId, staffId);
		// EmpInfoModel currentDoctor =
		// doctorService.getCurrentDoctor(currentUserId);
		if (grantedStf == null) {
			flag = false;
			message = "Fail to remove.";
			return SUCCESS;
		} else if (!grantedStf.isEmpty()) {
			for (EmpInfoModel stf : grantedStf) {
				if (stf != null) {
					stf.setUserId(hospitalUtil.idWrapper(stf.getUserId(), (byte) 2));
				}
			}
		}
		flag = true;
		message = "Remove successfully.";
		return SUCCESS;
	}

	public String allPatients() {
		patientSearchResult = doctorService.getAllPatients();
		Iterator<PatientInfoModel> it = patientSearchResult.iterator();
		PatientInfoModel tmp = new PatientInfoModel();
		long userId = -1;
		while (it.hasNext()) {
			tmp = it.next();
			userId = tmp.getUserId();
			tmp.setUserId(hospitalUtil.idWrapper(userId, (byte) 0));
		}
		return SUCCESS;
	}

	public String searchRecord() {
		flag = true;
		message = "";
		String wrappedPatientId = recordPatientId.trim();
		long patientId = -1;
		if (!wrappedPatientId.equals("")) {
			patientId = hospitalUtil.deIdWrapper(wrappedPatientId, (byte) 0);
		}
		if (patientId == -1) {
			flag = false;
			message += "Patient id cannot be empty for advanced search.<br />";
		}
		long recordTimeStart = -1;
		if (!startDate.trim().equals("")) {
			Calendar cStart = Calendar.getInstance();
			SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm");
			Date parsedDate = null;
			try {
				parsedDate = sdf.parse(startDate + " " + "00:00");
			} catch (ParseException e) {
				e.printStackTrace();
			}
			if (parsedDate != null) {
				cStart.setTime(parsedDate);
			}
			recordTimeStart = cStart.getTimeInMillis();
		}
		long recordTimeEnd = -1;
		if (!endDate.trim().equals("")) {
			Calendar cEnd = Calendar.getInstance();
			SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm");
			Date parsedDate = null;
			try {
				parsedDate = sdf.parse(endDate + " " + "00:00");
			} catch (ParseException e) {
				e.printStackTrace();
			}
			if (parsedDate != null) {
				cEnd.setTime(parsedDate);
			}
			recordTimeEnd = cEnd.getTimeInMillis() + 86400000;
		}
		if (recordTimeStart != -1 && recordTimeEnd != -1 && recordTimeStart >= recordTimeEnd) {
			flag = false;
			message += "The start time should not come after the end time.<br />";
		}
		if (false == flag) {
			return SUCCESS;
		}
		recordDetailList = doctorService.searchRecord(patientId, recordTimeStart, recordTimeEnd, recordDiagnosis,
				recordDrug, recordComment);
		Iterator<RecordDetailModel> it = recordDetailList.iterator();
		RecordDetailModel tmp = new RecordDetailModel();
		long wpatientId, wdoctorId;
		while (it.hasNext()) {
			tmp = it.next();
			wpatientId = tmp.getPatientId();
			tmp.setPatientId(hospitalUtil.idWrapper(wpatientId, (byte) 0));
			wdoctorId = tmp.getDoctorId();
			tmp.setDoctorId(hospitalUtil.idWrapper(wdoctorId, (byte) 1));
		}
		flag = true;
		return SUCCESS;
	}

	public String lookupAppointment() {
		doctorAppointments = doctorService.lookupAppointment();
		Iterator<DocScheduleModel> it = doctorAppointments.iterator();
		DocScheduleModel tmp = new DocScheduleModel();
		long patientId, doctorId, staffId;
		while (it.hasNext()) {
			tmp = it.next();
			patientId = tmp.getPatientId();
			tmp.setPatientId(hospitalUtil.idWrapper(patientId, (byte) 0));
			doctorId = tmp.getDoctorId();
			tmp.setDoctorId(hospitalUtil.idWrapper(doctorId, (byte) 1));
			staffId = tmp.getStaffId();
			tmp.setStaffId(hospitalUtil.idWrapper(staffId, (byte) 2));
		}
		return SUCCESS;
	}

	public String changePassword() {
		String encryptedPw = doctorService.checkPassword();
		if (encryptedPw.equals(hospitalUtil.encrypt(origPassword))) {
			if (newPassword.length() < 6) {
				flag = false;
				message = "Password needs to be at least 6 characters long";
				return SUCCESS;
			}
			if (newPassword.equals(confirmedNewPassword)) {
				boolean result = doctorService.changePassword(newPassword);
				if (result) {
					flag = true;
					message = "Change password successfully.";
					return SUCCESS;
				} else {
					flag = false;
					message = "Fail to change password.";
					return SUCCESS;
				}
			} else {
				flag = false;
				message = "New passwords do not match.";
				return SUCCESS;
			}
		} else {
			flag = false;
			message = "Incorrect password.";
			return SUCCESS;
		}

	}

	public String appointment() {
		return SUCCESS;
	}

	public String getRecordPatientId() {
		return recordPatientId;
	}

	public void setRecordPatientId(String recordPatientId) {
		this.recordPatientId = recordPatientId;
	}

	public String getRecordStart() {
		return recordStart;
	}

	public void setRecordStart(String recordStart) {
		this.recordStart = recordStart;
	}

	public String getRecordEnd() {
		return recordEnd;
	}

	public void setRecordEnd(String recordEnd) {
		this.recordEnd = recordEnd;
	}

	public String getRecordDiagnosis() {
		return recordDiagnosis;
	}

	public void setRecordDiagnosis(String recordDiagnosis) {
		this.recordDiagnosis = recordDiagnosis;
	}

	public String getRecordTreatSche() {
		return recordTreatSche;
	}

	public void setRecordTreatSche(String recordTreatSche) {
		this.recordTreatSche = recordTreatSche;
	}

	public String getRecordComment() {
		return recordComment;
	}

	public void setRecordComment(String recordComment) {
		this.recordComment = recordComment;
	}

	public VisitRecordModel getVisitRecord() {
		return visitRecord;
	}

	public void setVisitRecord(VisitRecordModel visitRecord) {
		this.visitRecord = visitRecord;
	}

	public DoctorService getDoctorService() {
		return doctorService;
	}

	public void setDoctorService(DoctorService doctorService) {
		this.doctorService = doctorService;
	}

	public String getMonthStart() {
		return monthStart;
	}

	public void setMonthStart(String monthStart) {
		this.monthStart = monthStart;
	}

	public String getDayStart() {
		return dayStart;
	}

	public void setDayStart(String dayStart) {
		this.dayStart = dayStart;
	}

	public String getHourStart() {
		return hourStart;
	}

	public void setHourStart(String hourStart) {
		this.hourStart = hourStart;
	}

	public String getMinuteStart() {
		return minuteStart;
	}

	public void setMinuteStart(String minuteStart) {
		this.minuteStart = minuteStart;
	}

	public String getMonthEnd() {
		return monthEnd;
	}

	public void setMonthEnd(String monthEnd) {
		this.monthEnd = monthEnd;
	}

	public String getDayEnd() {
		return dayEnd;
	}

	public void setDayEnd(String dayEnd) {
		this.dayEnd = dayEnd;
	}

	public String getHourEnd() {
		return hourEnd;
	}

	public void setHourEnd(String hourEnd) {
		this.hourEnd = hourEnd;
	}

	public String getMinuteEnd() {
		return minuteEnd;
	}

	public void setMinuteEnd(String minuteEnd) {
		this.minuteEnd = minuteEnd;
	}

	public String getSearchUserId() {
		return searchUserId;
	}

	public void setSearchUserId(String searchUserId) {
		this.searchUserId = searchUserId;
	}

	public String getSearchFirstname() {
		return searchFirstname;
	}

	public void setSearchFirstname(String searchFirstname) {
		this.searchFirstname = searchFirstname;
	}

	public String getSearchLastname() {
		return searchLastname;
	}

	public void setSearchLastname(String searchLastname) {
		this.searchLastname = searchLastname;
	}

	public List<PatientInfoModel> getPatientSearchResult() {
		return patientSearchResult;
	}

	public void setPatientSearchResult(List<PatientInfoModel> patientSearchResult) {
		this.patientSearchResult = patientSearchResult;
	}

	public String getRecordListPatientId() {
		return recordListPatientId;
	}

	public void setRecordListPatientId(String recordListPatientId) {
		this.recordListPatientId = recordListPatientId;
	}

	public List<RecordDetailModel> getRecordDetailList() {
		return recordDetailList;
	}

	public void setRecordDetailList(List<RecordDetailModel> recordDetailList) {
		this.recordDetailList = recordDetailList;
	}

	public String getSearchDocId() {
		return searchDocId;
	}

	public void setSearchDocId(String searchDocId) {
		this.searchDocId = searchDocId;
	}

	public String getSearchDocFirstname() {
		return searchDocFirstname;
	}

	public void setSearchDocFirstname(String searchDocFirstname) {
		this.searchDocFirstname = searchDocFirstname;
	}

	public String getSearchDocLastname() {
		return searchDocLastname;
	}

	public void setSearchDocLastname(String searchDocLastname) {
		this.searchDocLastname = searchDocLastname;
	}

	public List<EmpInfoModel> getDocSearchResult() {
		return docSearchResult;
	}

	public void setDocSearchResult(List<EmpInfoModel> docSearchResult) {
		this.docSearchResult = docSearchResult;
	}

	public String getSearchStaffId() {
		return searchStaffId;
	}

	public void setSearchStaffId(String searchStaffId) {
		this.searchStaffId = searchStaffId;
	}

	public String getSearchStaffFirstname() {
		return searchStaffFirstname;
	}

	public void setSearchStaffFirstname(String searchStaffFirstname) {
		this.searchStaffFirstname = searchStaffFirstname;
	}

	public String getSearchStaffLastname() {
		return searchStaffLastname;
	}

	public void setSearchStaffLastname(String searchStaffLastname) {
		this.searchStaffLastname = searchStaffLastname;
	}

	public List<EmpInfoModel> getStaffSearchResult() {
		return staffSearchResult;
	}

	public void setStaffSearchResult(List<EmpInfoModel> staffSearchResult) {
		this.staffSearchResult = staffSearchResult;
	}

	public String getConfirmedPatientId() {
		return confirmedPatientId;
	}

	public void setConfirmedPatientId(String confirmedPatientId) {
		this.confirmedPatientId = confirmedPatientId;
	}

	public String getConfirmedDocId() {
		return confirmedDocId;
	}

	public void setConfirmedDocId(String confirmedDocId) {
		this.confirmedDocId = confirmedDocId;
	}

	public String getConfirmedStaffId() {
		return confirmedStaffId;
	}

	public void setConfirmedStaffId(String confirmedStaffId) {
		this.confirmedStaffId = confirmedStaffId;
	}

	public String getRecordDrug() {
		return recordDrug;
	}

	public void setRecordDrug(String recordDrug) {
		this.recordDrug = recordDrug;
	}

	public String getRecordInstruction() {
		return recordInstruction;
	}

	public void setRecordInstruction(String recordInstruction) {
		this.recordInstruction = recordInstruction;
	}

	public String getRecordDeaNum() {
		return recordDeaNum;
	}

	public void setRecordDeaNum(String recordDeaNum) {
		this.recordDeaNum = recordDeaNum;
	}

	public String getYearStart() {
		return yearStart;
	}

	public void setYearStart(String yearStart) {
		this.yearStart = yearStart;
	}

	public List<DocScheduleModel> getDoctorAppointments() {
		return doctorAppointments;
	}

	public void setDoctorAppointments(List<DocScheduleModel> doctorAppointments) {
		this.doctorAppointments = doctorAppointments;
	}

	public boolean isFlag() {
		return flag;
	}

	public void setFlag(boolean flag) {
		this.flag = flag;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getYearEnd() {
		return yearEnd;
	}

	public void setYearEnd(String yearEnd) {
		this.yearEnd = yearEnd;
	}

	public String getStartDate() {
		return startDate;
	}

	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

	public String getStartTime() {
		return startTime;
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}

	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public String getLookupPmsId() {
		return lookupPmsId;
	}

	public void setLookupPmsId(String lookupPmsId) {
		this.lookupPmsId = lookupPmsId;
	}

	public Set<EmpInfoModel> getGrantedDoc() {
		return grantedDoc;
	}

	public void setGrantedDoc(Set<EmpInfoModel> grantedDoc) {
		this.grantedDoc = grantedDoc;
	}

	public Set<EmpInfoModel> getGrantedStf() {
		return grantedStf;
	}

	public void setGrantedStf(Set<EmpInfoModel> grantedStf) {
		this.grantedStf = grantedStf;
	}

	public String getRemovePmsId() {
		return removePmsId;
	}

	public void setRemovePmsId(String removePmsId) {
		this.removePmsId = removePmsId;
	}

	public String getRemovePmsDocId() {
		return removePmsDocId;
	}

	public void setRemovePmsDocId(String removePmsDocId) {
		this.removePmsDocId = removePmsDocId;
	}

	public String getRemovePmsStfId() {
		return removePmsStfId;
	}

	public void setRemovePmsStfId(String removePmsStfId) {
		this.removePmsStfId = removePmsStfId;
	}

	public HospitalUtil getHospitalUtil() {
		return hospitalUtil;
	}

	public void setHospitalUtil(HospitalUtil hospitalUtil) {
		this.hospitalUtil = hospitalUtil;
	}

	public String getOrigPassword() {
		return origPassword;
	}

	public void setOrigPassword(String origPassword) {
		this.origPassword = origPassword;
	}

	public String getNewPassword() {
		return newPassword;
	}

	public void setNewPassword(String newPassword) {
		this.newPassword = newPassword;
	}

	public String getConfirmedNewPassword() {
		return confirmedNewPassword;
	}

	public void setConfirmedNewPassword(String confirmedNewPassword) {
		this.confirmedNewPassword = confirmedNewPassword;
	}

}
